package com.hnguigu.health.houduan.lcj.service_lcj.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hnguigu.health.houduan.lcj.mapper_lcj.TDiseaseLibraryMapper_lcj;
import com.hnguigu.health.houduan.lcj.pojo_lcj.PagVo_lcj;
import com.hnguigu.health.houduan.lcj.pojo_lcj.TDiseaseLibrary_lcj;
import com.hnguigu.health.houduan.lcj.service_lcj.TDiseaseLibraryService_lcj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TDiseaseLibraryServiceImpl_lcj implements TDiseaseLibraryService_lcj {
    @Autowired(required = false)
    TDiseaseLibraryMapper_lcj tdislib;

    @Override
    public PagVo_lcj<TDiseaseLibrary_lcj> getpage(Integer page, Integer num, TDiseaseLibrary_lcj tDiseaseLibrary_lcj) {
        PageHelper.startPage(page,num);
        String name = tDiseaseLibrary_lcj.getName();
        String clinicDepartmentId = tDiseaseLibrary_lcj.getClinicDepartmentId();
        name=name.equals("")?null:name;
        clinicDepartmentId=clinicDepartmentId.equals("0")?null:clinicDepartmentId;
        tDiseaseLibrary_lcj.setName(name);
        tDiseaseLibrary_lcj.setClinicDepartmentId(clinicDepartmentId);
        List<TDiseaseLibrary_lcj> all = tdislib.findAll(tDiseaseLibrary_lcj);
        PageInfo<TDiseaseLibrary_lcj> pageInfo = new PageInfo<>(all);
        PagVo_lcj<TDiseaseLibrary_lcj> pagVo_lcj = new PagVo_lcj<>(pageInfo.getTotal(), pageInfo.getList());
        return pagVo_lcj;
    }

    @Override
    public int insertSelective(TDiseaseLibrary_lcj record) {
        return tdislib.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(TDiseaseLibrary_lcj record) {
        return tdislib.updateByPrimaryKeySelective(record);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return tdislib.deleteByPrimaryKey(id);
    }

    @Override
    public TDiseaseLibrary_lcj getBycode(String code) {
        return tdislib.getBycode(code);
    }

    @Override
    public TDiseaseLibrary_lcj Lastbean() {
        return tdislib.Lastbean();
    }
}
